Skip to content

Conversation

owenv
Copy link
Contributor

@owenv owenv commented Aug 13, 2025

Closes #8973

Ensure test bundles get a main symbol on macOS so swiftpm-testing-helper can kick off tests. We may want to rename this entrypoint to solve some issues with testable executables though.

@owenv
Copy link
Contributor Author

owenv commented Aug 13, 2025

@swift-ci test

@@ -695,6 +695,11 @@ public final class SwiftBuildSystem: SPMBuildCore.BuildSystem {
settings["ARCHS"] = architectures.joined(separator: " ")
}

// When building with the CLI for macOS, test bundles should generate entrypoints for compatibility with swiftpm-testing-helper.
if buildParameters.triple.isMacOSX {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

macOS, or all Darwin?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well we don't support command-line execution of tests on other Apple platforms anyway, so...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Execution doesn't matter, this is about the build. The build system does not assume that the machine/tool building the tests is the one running them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay: we support neither building nor executing tests on iOS using SwiftPM.

Copy link
Contributor

@bkhouri bkhouri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, though it does appears we have regressed in some areas.

@@ -278,7 +266,7 @@ struct TestCommandTests {
)
}
} when: {
buildSystem == .swiftbuild && ProcessInfo.hostOperatingSystem == .windows
buildSystem == .swiftbuild
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (possibly-blocking): this seems like a regression as this is now failing on all platforms, while it was previously only failing on Windows. Why is the plan to address this?

(buildSystem == .swiftbuild && .linux == ProcessInfo.hostOperatingSystem)
// || (buildSystem == .swiftbuild && .windows == ProcessInfo.hostOperatingSystem && CiEnvironment.runningInSelfHostedPipeline)
|| (buildSystem == .swiftbuild && .windows == ProcessInfo.hostOperatingSystem )
buildSystem == .swiftbuild
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (possibly-blocking): this seems like a regression as this was previously passing on macOs, but is not failing. Why is the plan to address this?

(buildSystem == .swiftbuild && ProcessInfo.hostOperatingSystem == .windows)
|| (buildSystem == .swiftbuild && ProcessInfo.hostOperatingSystem == .linux && CiEnvironment.runningInSmokeTestPipeline)
|| (buildSystem == .swiftbuild && ProcessInfo.hostOperatingSystem == .linux && CiEnvironment.runningInSelfHostedPipeline) // error: SwiftCompile normal x86_64 /tmp/Miscellaneous_EchoExecutable.sxkNTX/Miscellaneous_EchoExecutable/.build/x86_64-unknown-linux-gnu/Intermediates.noindex/EchoExecutable.build/Debug-linux/TestSuite-test-runner.build/DerivedSources/test_entry_point.swift failed with a nonzero exit code
buildSystem == .swiftbuild
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (possibly-blocking): this has a catch all, while the previous changes were targeting specific issues on the platforms. It can be argued the test was passing on macOS, except we were not seeing the expected outputs, which may be expected for SwiftBuild.

What is the plan to address this?

@@ -300,8 +288,7 @@ struct TestCommandTests {
#expect(result.stderr.contains("-enable-testing"))
}
} when: {
(buildSystem == .swiftbuild && .windows == ProcessInfo.hostOperatingSystem)
|| (buildSystem == .swiftbuild && .linux == ProcessInfo.hostOperatingSystem && CiEnvironment.runningInSelfHostedPipeline)
buildSystem == .swiftbuild
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as before.

@owenv owenv force-pushed the owenv/macos-entry branch from 627f0ba to b19a7f1 Compare August 20, 2025 21:11
@owenv
Copy link
Contributor Author

owenv commented Aug 20, 2025

@swift-ci test

@owenv
Copy link
Contributor Author

owenv commented Aug 20, 2025

@swift-ci test Windows

Copy link
Contributor

@bkhouri bkhouri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the PR is in draft, but I have a comment, which may or may not be applicable :)

@@ -159,6 +159,7 @@ struct TestCommandTests {
}
} when: {
(buildSystem == .swiftbuild && ProcessInfo.hostOperatingSystem == .windows)
|| (buildSystem == .swiftbuild && ProcessInfo.hostOperatingSystem == .macOS)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: this seems like a regression in behaviour since this is now failing on macOS, where it was previously passing.. Is there an issue tracking the proper resolution?

@owenv owenv force-pushed the owenv/macos-entry branch from b19a7f1 to 86ad587 Compare September 3, 2025 17:48
@owenv
Copy link
Contributor Author

owenv commented Sep 3, 2025

@swift-ci test

@owenv
Copy link
Contributor Author

owenv commented Sep 3, 2025

@swift-ci test Windows

@owenv
Copy link
Contributor Author

owenv commented Sep 4, 2025

@swift-ci test self hosted

@owenv owenv force-pushed the owenv/macos-entry branch from 86ad587 to dc198e1 Compare September 5, 2025 00:24
@owenv
Copy link
Contributor Author

owenv commented Sep 5, 2025

@swift-ci test self hosted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SwiftBuild] swift-build won't run swift-testing tests
4 participants